package cn.iocoder.yudao.module.system.controller.admin.teacherdashboard.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Schema(description = "管理后台 - 升学分析结果 Response VO")
@Data
public class AdmissionAnalysisRespVO {

    @Schema(description = "班级基本信息")
    private ClassBasicInfo classInfo;

    @Schema(description = "升学预测统计")
    private AdmissionPredictionStats predictionStats;

    @Schema(description = "可报考大学统计")
    private UniversityStats universityStats;

    @Schema(description = "临界学生分析")
    private CriticalStudentAnalysis criticalStudents;

    @Schema(description = "目标达成情况")
    private TargetAchievementInfo targetAchievement;

    @Schema(description = "升学趋势分析")
    private AdmissionTrendAnalysis trendAnalysis;

    @Schema(description = "个人升学详情")
    private List<StudentAdmissionDetail> studentDetails;

    /**
     * 班级基本信息
     */
    @Data
    public static class ClassBasicInfo {
        @Schema(description = "班级ID", example = "1")
        private Long classId;

        @Schema(description = "班级名称", example = "高三(1)班")
        private String className;

        @Schema(description = "学生总数", example = "45")
        private Integer totalStudents;

        @Schema(description = "参考人数", example = "44")
        private Integer participantCount;

        @Schema(description = "考试名称", example = "期中考试")
        private String examName;

        @Schema(description = "考试时间", example = "2024-01-15T08:30:00")
        private LocalDateTime examDate;
    }

    /**
     * 升学预测统计
     */
    @Data
    public static class AdmissionPredictionStats {
        @Schema(description = "985院校预测上线人数", example = "8")
        private Integer predicted985Count;

        @Schema(description = "985院校预测上线率", example = "18.2")
        private BigDecimal predicted985Rate;

        @Schema(description = "211院校预测上线人数", example = "15")
        private Integer predicted211Count;

        @Schema(description = "211院校预测上线率", example = "34.1")
        private BigDecimal predicted211Rate;

        @Schema(description = "双一流院校预测上线人数", example = "18")
        private Integer predictedDoubleFirstClassCount;

        @Schema(description = "双一流院校预测上线率", example = "40.9")
        private BigDecimal predictedDoubleFirstClassRate;

        @Schema(description = "一本线预测上线人数", example = "35")
        private Integer predictedFirstTierCount;

        @Schema(description = "一本线预测上线率", example = "79.5")
        private BigDecimal predictedFirstTierRate;

        @Schema(description = "二本线预测上线人数", example = "42")
        private Integer predictedSecondTierCount;

        @Schema(description = "二本线预测上线率", example = "95.5")
        private BigDecimal predictedSecondTierRate;

        @Schema(description = "专科线预测上线人数", example = "44")
        private Integer predictedSpecialtyCount;

        @Schema(description = "专科线预测上线率", example = "100.0")
        private BigDecimal predictedSpecialtyRate;

        @Schema(description = "未达线人数", example = "0")
        private Integer belowLineCount;

        @Schema(description = "未达线率", example = "0.0")
        private BigDecimal belowLineRate;
    }

    /**
     * 可报考大学统计
     */
    @Data
    public static class UniversityStats {
        @Schema(description = "985大学可报考情况")
        private Map<String, UniversityAdmissionInfo> universities985;

        @Schema(description = "211大学可报考情况")
        private Map<String, UniversityAdmissionInfo> universities211;

        @Schema(description = "双一流大学可报考情况")
        private Map<String, UniversityAdmissionInfo> universitiesDoubleFirstClass;

        @Schema(description = "热门大学可报考情况")
        private Map<String, UniversityAdmissionInfo> popularUniversities;

        @Schema(description = "各层次大学统计")
        private Map<String, Integer> universityLevelStats;
    }

    /**
     * 大学录取信息
     */
    @Data
    public static class UniversityAdmissionInfo {
        @Schema(description = "大学名称", example = "清华大学")
        private String universityName;

        @Schema(description = "大学类型", example = "985")
        private String universityType;

        @Schema(description = "历年录取分数线", example = "680")
        private BigDecimal admissionScore;

        @Schema(description = "可报考学生数", example = "3")
        private Integer eligibleStudentCount;

        @Schema(description = "冲刺学生数", example = "2")
        private Integer stretchStudentCount;

        @Schema(description = "稳妥学生数", example = "1")
        private Integer safeStudentCount;

        @Schema(description = "保底学生数", example = "0")
        private Integer guaranteedStudentCount;

        @Schema(description = "热门专业")
        private List<String> popularMajors;
    }

    /**
     * 临界学生分析
     */
    @Data
    public static class CriticalStudentAnalysis {
        @Schema(description = "985临界学生")
        private List<CriticalStudentInfo> critical985Students;

        @Schema(description = "211临界学生")
        private List<CriticalStudentInfo> critical211Students;

        @Schema(description = "一本临界学生")
        private List<CriticalStudentInfo> criticalFirstTierStudents;

        @Schema(description = "二本临界学生")
        private List<CriticalStudentInfo> criticalSecondTierStudents;

        @Schema(description = "临界学生总数", example = "12")
        private Integer totalCriticalStudents;

        @Schema(description = "临界学生占比", example = "27.3")
        private BigDecimal criticalStudentRate;
    }

    /**
     * 临界学生信息
     */
    @Data
    public static class CriticalStudentInfo {
        @Schema(description = "学生ID", example = "1001")
        private Long studentId;

        @Schema(description = "学生姓名", example = "张三")
        private String studentName;

        @Schema(description = "学号", example = "G3C1001")
        private String studentNo;

        @Schema(description = "当前预估分数", example = "678")
        private BigDecimal currentScore;

        @Schema(description = "目标分数线", example = "680")
        private BigDecimal targetScore;

        @Schema(description = "分数差距", example = "2")
        private BigDecimal scoreDiff;

        @Schema(description = "目标层次", example = "985")
        private String targetLevel;

        @Schema(description = "薄弱科目")
        private List<String> weakSubjects;

        @Schema(description = "提升建议", example = "数学需要提升5分，物理需要提升3分")
        private String improvementSuggestion;

        @Schema(description = "提升可能性", example = "高")
        private String improvementPossibility;
    }

    /**
     * 目标达成情况
     */
    @Data
    public static class TargetAchievementInfo {
        @Schema(description = "班级目标设定")
        private ClassTargetInfo classTarget;

        @Schema(description = "当前达成情况")
        private CurrentAchievementInfo currentAchievement;

        @Schema(description = "预期达成情况")
        private ExpectedAchievementInfo expectedAchievement;

        @Schema(description = "改进建议")
        private List<String> improvementSuggestions;
    }

    /**
     * 班级目标信息
     */
    @Data
    public static class ClassTargetInfo {
        @Schema(description = "一本目标人数", example = "36")
        private Integer firstTierTargetCount;

        @Schema(description = "一本目标率", example = "80.0")
        private BigDecimal firstTierTargetRate;

        @Schema(description = "985目标人数", example = "10")
        private Integer target985Count;

        @Schema(description = "985目标率", example = "22.2")
        private BigDecimal target985Rate;

        @Schema(description = "211目标人数", example = "18")
        private Integer target211Count;

        @Schema(description = "211目标率", example = "40.0")
        private BigDecimal target211Rate;
    }

    /**
     * 当前达成情况
     */
    @Data
    public static class CurrentAchievementInfo {
        @Schema(description = "一本达成率", example = "97.2")
        private BigDecimal firstTierAchievementRate;

        @Schema(description = "985达成率", example = "80.0")
        private BigDecimal achievement985Rate;

        @Schema(description = "211达成率", example = "83.3")
        private BigDecimal achievement211Rate;

        @Schema(description = "整体评估", example = "目标基本达成")
        private String overallAssessment;
    }

    /**
     * 预期达成情况
     */
    @Data
    public static class ExpectedAchievementInfo {
        @Schema(description = "预期一本达成率", example = "100.0")
        private BigDecimal expectedFirstTierRate;

        @Schema(description = "预期985达成率", example = "90.0")
        private BigDecimal expected985Rate;

        @Schema(description = "预期211达成率", example = "88.9")
        private BigDecimal expected211Rate;

        @Schema(description = "达成可能性", example = "高")
        private String achievementPossibility;
    }

    /**
     * 升学趋势分析
     */
    @Data
    public static class AdmissionTrendAnalysis {
        @Schema(description = "历次考试升学预测变化")
        private List<AdmissionTrendPoint> trendPoints;

        @Schema(description = "整体趋势", example = "稳步上升")
        private String overallTrend;

        @Schema(description = "一本上线率变化", example = "5.2")
        private BigDecimal firstTierRateChange;

        @Schema(description = "985上线率变化", example = "2.3")
        private BigDecimal rate985Change;

        @Schema(description = "211上线率变化", example = "3.1")
        private BigDecimal rate211Change;

        @Schema(description = "趋势预测", example = "继续上升")
        private String trendPrediction;
    }

    /**
     * 升学趋势点
     */
    @Data
    public static class AdmissionTrendPoint {
        @Schema(description = "考试ID", example = "1")
        private Long examId;

        @Schema(description = "考试名称", example = "月考一")
        private String examName;

        @Schema(description = "考试时间", example = "2024-01-15T08:30:00")
        private LocalDateTime examDate;

        @Schema(description = "一本预测上线率", example = "75.6")
        private BigDecimal firstTierRate;

        @Schema(description = "985预测上线率", example = "15.6")
        private BigDecimal rate985;

        @Schema(description = "211预测上线率", example = "31.1")
        private BigDecimal rate211;

        @Schema(description = "班级平均分", example = "615.5")
        private BigDecimal classAvgScore;
    }

    /**
     * 学生升学详情
     */
    @Data
    public static class StudentAdmissionDetail {
        @Schema(description = "学生ID", example = "1001")
        private Long studentId;

        @Schema(description = "学生姓名", example = "张三")
        private String studentName;

        @Schema(description = "学号", example = "G3C1001")
        private String studentNo;

        @Schema(description = "当前总分", example = "684.5")
        private BigDecimal currentScore;

        @Schema(description = "预估高考分数", example = "678")
        private BigDecimal predictedGaokaoScore;

        @Schema(description = "预测升学层次", example = "985")
        private String predictedAdmissionLevel;

        @Schema(description = "可报考大学")
        private List<String> eligibleUniversities;

        @Schema(description = "冲刺大学")
        private List<String> stretchUniversities;

        @Schema(description = "稳妥大学")
        private List<String> safeUniversities;

        @Schema(description = "保底大学")
        private List<String> guaranteedUniversities;

        @Schema(description = "推荐专业")
        private List<String> recommendedMajors;

        @Schema(description = "提升空间分析", example = "数学还有10分提升空间")
        private String improvementAnalysis;
    }

}
